﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ServiceBus.Contract;
using System.Reflection;

namespace ServiceBus.Service
{
    //[ServiceKnownType("KnowTypes.GetKnownTypes")]
    
    public class SAOService<T> : ISAOService
    {
        public object Invoke(string methodname, params object[] args)
        {
            try
            {
                object obj = typeof(T).InvokeMember(methodname, BindingFlags.Static |
                    BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.InvokeMethod, null, null, args);
                return obj;
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
        
    }
}
